<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CourseCreate extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'list.*.class_id' => 'required',
            'list.*.classroom_id' => 'sometimes',
            'list.*.len' => 'sometimes',
            'list.*.note' => 'sometimes|min:0|max:200',
            'list.*.start_time' =>'required|date_format:U',
            'list.*.subject_id' => 'required',
            'list.*.teacher_id' => 'required',
            'list.*.type' => 'required'
        ];
    }

}
